package com.dcjt.firehotcarpad.adapter

import android.graphics.Color
import com.aries.ui.view.radius.RadiusTextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.dcjt.firehotcarpad.R
import com.dcjt.firehotcarpad.entity.FunEntity


/**
 * 出差出访列表
 */
class FunctionButtonAdapter(data: List<FunEntity>?) :
    BaseQuickAdapter<FunEntity, BaseViewHolder>(R.layout.item_function_button, data) {

    override fun convert(helper: BaseViewHolder?, item: FunEntity?) {
        helper!!
        item!!
        val rtvText = helper.getView<RadiusTextView>(R.id.rtv_text)
        val delegate = rtvText.delegate
        rtvText.text = item.str


        if (!item.enable) {
            delegate.setBackgroundColor(mContext.resources.getColor(R.color.button_1))
            delegate.setTextColor(mContext.resources.getColor(R.color.button_2))
            delegate.setStrokeWidth(2)
            delegate.setStrokeColor(mContext.resources.getColor(R.color.button_3))
        } else if (!item.common){
            delegate.setBackgroundColor(mContext.resources.getColor(R.color.sendItemColor))
            delegate.setTextColor(Color.WHITE)
        } else{
            delegate.setBackgroundColor(mContext.resources.getColor(R.color.mainColor))
            delegate.setTextColor(Color.WHITE)
        }


    }
}